<%= render 'base' %>

<% content_for :scripts do %>
<script type="text/javascript">
  $(document).ready(function(){
  })

</script>
<% end %>
<div class="sidebar">
    <%= render_cell :topics, :sidebar_for_new_topic_node, { :action => params[:action], :node => @node } %>
    <%= render_cell :topics, :sidebar_for_more_like_this, { :topic => @topic} %>
</div>

<div class="content">
  <div id="topic_show" class="topics box">
    <div class="topic">
      <div class="pull-right avatar_large">
        <%= user_avatar_tag(@topic.user, :large, :link => false) %>
      </div>

      <%= render :partial => "topics/topic_info", :locals => { :topic => @topic} %>

      <%= raw SiteConfig.before_topic_html %>

      <div class="body">
        <%= format_topic_body(@topic.body) %>
      </div>

      <%= raw SiteConfig.after_topic_html %>

      <div class="tools pull-right">
        <%= likeable_tag(@topic) %>
        <% if owner?(@topic) or admin? %>
          <%= link_to "", edit_topic_path(@topic), :class => "icon small_edit", :title => "修改本帖" %>
          <%= link_to "", topic_path(@topic.id), :method => :delete, :confirm => t("common.confirm_delete"), :class => "icon small_delete", :title => "删除本帖" %>
        <% end %>
      </div>
      <%= render :partial => "common/share", :locals => {:title => @topic.title, :url => "http://#{Setting.domain}" + topic_path(@topic) } %>

    </div>
  </div>

  <%= render :partial => "topics/replies", :locals => { :topic => @topic, :replies => @replies } %>

  <% if current_user %>
    <div id="reply" class="form box">
      <%= render "editor_toolbar" %>
      <%= form_for(Reply.new, :remote => true,:url => topic_replies_path(@topic)) do |f| %>
        <div class="submit_buttons pull-right">
          <button type="submit" id="btn_reply" class="btn primary" tabindex="2"><%= t("topics.submit_reply")%></button><br />
          <span class="help-inline">Ctrl+Enter</span>
        </div>
        <%= f.text_area :body,:class => "topic_editor span10", :rows => "4", :tabindex => "1" %>
        
        <span class="body helpblock">
          <%= render_cell :topics, :reply_help_block %>
        </span>
      <% end %>
    </div>
  <% else %>
      <%= render :partial => "topics/translation/need_login_to_reply" %>
  <% end %>
</div>


